# TODO: Add comment
# 
# Author: Forever
###############################################################################
library(hydroGOF)
library(clusterSim)

inputPath = "C:/Users/Forever/Desktop/MOD01/"
listFile = list.files(path = inputPath,pattern="*mod_year_20*",full.names = FALSE,recursive=FALSE)
size = length(listFile)
result = data.frame()
for(i in 1:size){
	
	file_name = listFile[i]
	full_name = paste(inputPath,file_name,sep="")
	data = read.csv(full_name)
	
	number_image = nrow(data)
	avg_pixel = round(mean(data$totalRow),3)
	avg_R2 = round(mean(data$uCor[!is.na(data$uCor)]),3)

	#avg_R2 = round(mean(data$uCor),3)
	avg_RMSE = round(mean(data$uRMSE),3)
	avg_RE = round(mean(data$uRE),3)
	
	result = rbind(result,data.frame(file_name,number_image,avg_pixel,avg_R2,avg_RMSE,avg_RE))
	
}
outFile = paste(inputPath,"mod_year_result_2.csv")
write.csv(result,file=outFile)

